import Date from '@/common/date.js'
export default{
	data(){
		return {
			shopList:[],
			shopTypeZindex:0,
			isShowShop: false,
			isShowDate: false,
			tagList:[
				{title:'今天', shape:'square', mode:'dark', type:"primary", id:'T01'},
				{title:'昨天', shape:'square', mode:'dark', type:"info", id:'T02'},
				{title:'近七天', shape:'square', mode:'dark', type:"info", id:'T03'},
				{title:'近30天', shape:'square', mode:'dark', type:"info", id:'T04'},
				{title:'本月', shape:'square', mode:'dark', type:"info", id:'T05'}
			],
		}
	},
	onLoad(){
		
	},
	methods:{
		onClickChangeDate(arrDate,type){
			if(type) {
				this.type.star_date = arrDate[0]
				this.type.end_date = arrDate[arrDate.length-1]
				return
			}
			this.sData.star_date = arrDate[0]
			this.sData.end_date = arrDate[arrDate.length-1]
		},
		confirmShop(e, value, name, index, list){
			if(e.indexs[0] == null || e.indexs[0] === -1){
				this[index]= 0
				this.sData[value] = this[list][this[index]][0].value
				this.sData[name] =this[list][this[index]][0].label
			}else {
				const uifo = this.$store.state.userInfo
				this.sData[value] = e.value[0].value
				this[index] = e.indexs[0]
				this.sData[name] = e.value[0].label
				const setUIfo = {
					...uifo,
					FStockName: e.value[0].label,
					shop_appid: e.value[0].shop_appid,
					FStockID: e.value[0].FStockID,
					FUserID: e.value[0].FUserID,
					FUserName: e.value[0].FTelephone
				}
				this.$store.commit('login', setUIfo)
			}
		},
		onTagBtn(ix){
			if(this.tagIndex === ix) return
			this.tagIndex = ix
			this.tagList = this.tagList.map((jm,jx)=>{
				if(ix === jx) {jm.type = 'primary'}
				else {
					jm.type = 'info'
				}
				return jm
			})
			switch(ix){
				case 0:
					this.sData.star_date = Date.getDate(0)
					this.sData.end_date = Date.getDate(0)
				break;
				case 1:
					this.sData.star_date = Date.getDate(1)
					this.sData.end_date = Date.getDate(1)
				break;
				case 2:
					this.sData.star_date = Date.getDate(7)
					this.sData.end_date = Date.getDate(0)
				break;
				case 3:
					this.sData.star_date = Date.getDate(30)
					this.sData.end_date = Date.getDate(0)
				break;
				case 4:
					this.sData.star_date = Date.getStartDate()
					this.sData.end_date = Date.getDate(0)
				break;
			}
			this.getAnalysisData()
		}
	}
}